package com.lagou.lagouserviceemail;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.autoconfigure.mail.MailProperties;
import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @Authther: mrwu
 * @date:2021/4/23-04
 * @Description:com.lagou.lagouserviceemail
 */
@RestController
public class ConfigController implements BeanFactoryPostProcessor {
    @Autowired
    Environment environment;
    @GetMapping("/view")
    public void env(){
        System.out.println(environment.getProperty("spring.mail.username"));
//        System.out.println(mailProperties.getProperties());
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
//        BeanDefinition beanDefinition = configurableListableBeanFactory.getBeanDefinition("javaMailSender");
//        System.out.println();
    }
}
